﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TSharp.Core.Util;
using TSharp.Core.SystemOption.Facade;

using TSharp.Core.Repository;
using TSharp.Core.SystemOption.Store.Entities;

namespace TSharp.Core.SystemOption.Controllers
{
    public class HomeController : Controller
    {
        readonly ICustomerRepository _a;
        public HomeController(ICustomerRepository a)
        {
            _a = a;
        }

        public ActionResult Index(int? pageNum)
        {
            int index = pageNum.HasValue ? pageNum.Value : 1;
            return View(_a.Specify().ToResult().OrderByAscending(x => x.CustomerID).AsPagination(index));
        }
      
        public ActionResult Test()
        {
            Customer c = new Customer()
                             {
                                 Address = "test address",
                                 Region = "Test Region"
                             };
            //_a.Insert(c);
            return View();
        }
    }
}
